import axios from 'axios'

axios.defaults.baseURL = 'http://localhost:8888/api'

// 获取新闻列表
export const getNewList = () => axios.get('/getnewslist').then(res => res.data)

// 获取新闻详情
export const getNewDetail = id => axios.get(`/getnew/${id}`).then(res => res.data)

// 获取评论
export const getNewsComments = (id, pageIndex) => axios.get(`/getcomments/${id}?pageindex=${pageIndex}`).then(res => res.data)

// 发表评论
export const postComments = (id, content) => axios.post(`/postcomment/${id}`, content).then(res => res.data)
